<template>

  <article class="col-7 fl">
    <div class="u-r-cont">
      <el-form ref="member" :model="member" label-width="80px">
        <el-form-item label="昵称">
          <el-input v-model="member.nickname"/>
        </el-form-item>
        <el-form-item label="手机号">
          <el-input v-model="member.mobile"/>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input v-model="member.age"/>
        </el-form-item>
        <el-form-item label="性别">
          <el-select v-model="member.sex" placeholder="请选择">
            <el-option label="男" value="1"/>
            <el-option label="女" value="2"/>
          </el-select>
        </el-form-item>
        <el-form-item label="用户签名">
          <el-input v-model="member.sign" type="textarea"/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">保存</el-button>
        </el-form-item>
      </el-form>
    </div>
  </article>
</template>
<script>
import userApi from '~/api/userCenter'

export default {
  name: 'UcBase',
  data() {
    return {
      member: {
        nickname: '',
        mobile: '',
        age: '',
        sex: '',
        sign: '',
        avatar: ''
      }
    }
  },
  created() {
    this.fetchWebMemberById()
  },
  methods: {
    onSubmit() {
      userApi.updateByWebMemberVo(this.member).then(res => {
        this.$message.success(res.message)
      })
    },
    fetchWebMemberById() {
      userApi.getWebMemberVo().then(res => {
        this.member = res.data.webMemberVo
      })
    }
  }
}
</script>

<style scoped>

</style>
